/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proj5labbd;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;


//Classe para leitura de scripts sql
public class ScriptReader {
    
    //Le um scripts sql
    public static String read( String filename ) throws FileNotFoundException, IOException {
        String str;
        StringBuilder sbuff = new StringBuilder();
        Reader isReader = new InputStreamReader( ScriptReader.class.getResourceAsStream("scripts/"+filename) );
        BufferedReader reader = new BufferedReader(isReader);
        while ((str = reader.readLine()) != null )
            sbuff.append(str+"\n");
        
        return sbuff.toString();
    }
    
}
